<script>on mouseUpanswer "The game is already Paused." & return & "Click the ΓÇ£GOΓÇ¥ button to start the game." with "OK"end mouseUp</script>
</part>
<part>
<id>34</id>
<type>button</type>
<visible> <true /> </visible>
<reserved5> 0 </reserved5>
<reserved4> 0 </reserved4>
<reserved3> 0 </reserved3>
<reserved2> 0 </reserved2>
<reserved1> 0 </reserved1>
<enabled> <true /> </enabled>
<rect>
<left>467</left>
<top>316</top>
<right>496</right>
<bottom>333</bottom>
</rect>
<style>roundrect</style>
<showName> <true /> </showName>
<highlight> <false /> </highlight>
<autoHighlight> <true /> </autoHighlight>
<sharedHighlight> <false /> </sharedHighlight>
<family>0</family>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>center</textAlign>
<font>Chicago</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<name>GO</name>
<script>--Icon names are <direction> <num of masts> "Mast"--Icon id's are:-- N = 1000 + num of masts-- E = 2000 " "-- S = 3000 " "-- W = 4000 " "--Both ships should fire if both are at the broadside.on mouseUpglobal theShip,theCourse,RedShips,BlueShips,MerchantShips,SoundOn,Turnglobal GameInProgress,PauseGame,Opponenthide menubarhide msgif SoundOn then play "flute" tempo 150 "c6s f6h c6q"put false into PauseGameput true into Redoif bg fld "SavedGame" ≠ empty thenanswer "Start new game or finish current game?" with "New" or "Current"if it = "Current" then put false into Redoend ifif Redo thenput empty into bg fld "SavedGame"put "Red" into Turnput 10 into RedShipsput 10 into BlueShipsput 4 into MerchantShipsArrangeShipselseput line 1 of bg fld "SavedGame" into Turnput line 2 of bg fld "SavedGame" into RedShipsput line 3 of bg fld "SavedGame" into BlueShipsput line 4 of bg fld "SavedGame" into MerchantShipsend ifMainGameif PauseGame thenset the hilite of bg btn "Pause" to trueput Turn & return into bg fld "SavedGame"put RedShips & return after bg fld "SavedGame"put BlueShips & return after bg fld "SavedGame"put MerchantShips after bg fld "SavedGame"set the hilite of bg btn "Pause" to falseelseput empty into bg fld "SavedGame"end ifshow menubarend mouseUpon MainGameglobal theShip,theCourse,RedShips,BlueShips,MerchantShips,SoundOn,Turnglobal GameInProgress,PauseGame,BlueOpponent,RedOpponentrepeat until RedWon() or BlueWon() or PauseGameif Turn = "Red" then --REDset cursor to "Red"if RedOpponent = "Human" thenput GetShip(11,20) into theShipif not PauseGame thenput PlotCourse() into theCourseMoveShipput Fire(1,10) into HitShipsExplode HitShips,Turnif the number of items of HitShips > 0 thenReturnFire HitShips,Turnend ifput "Blue" into Turnend ifelseComputerMove Turn,11,20put "Blue" into Turnend ifelse --BLUEset cursor to "Blue"if BlueOpponent = "Human" thenput GetShip(1,10) into theShipif not PauseGame thenput PlotCourse() into theCourseMoveShipput Fire(11,20) into HitShipsExplode HitShips,Turnif the number of items of HitShips > 0 thenReturnFire HitShips,Turnend ifput "Red" into Turnend ifelseComputerMove Turn,1,10put "Red" into Turnend ifend ifend repeatend MainGameon ComputerMove color,lo,higlobal theShip,theCourse,Forfeitput GetRandomShip(color,lo,hi) into theShiprepeat 4Blink theShipend repeatset the hilite of bg btn theShip to trueput ComputerPlotCourse(color,Anti(lo),Anti(hi)) into theCourseset the hilite of bg btn theShip to falseset cursor to colorif Forfeit thenRemoveSail Anti(color)elseMoveShiphide bg btn "Course"put Fire(Anti(lo),Anti(hi)) into HitShipsExplode HitShips,colorif the number of items of HitShips > 0 thenReturnFire HitShips,colorend ifend ifend ComputerMovefunction GetRandomShip color,lo,hiput empty into VisShipsrepeat with i = lo to hiif the visible of bg btn i = true thenput i & "," after VisShipsend ifend repeatreturn item random(the number of items of VisShips) of VisShipsend GetRandomShipfunction ComputerPlotCourse color,lo,higlobal theShip,Forfeitset cursor to busyput false into Forfeitput item 1 of the loc of bg btn theShip into xput item 2 of the loc of bg btn theShip into y--\\\set the loc of bg btn "Course" to item 1 of the loc of bg btn theShip,60--Check to see if a Red ship can blow away a Merchant ship.if (theShip > 10) and (item 2 of the loc of bg btn theShip = 60) thenput "horizontal" into ShipIsMoving--Check to see if a Red ship has a clear path to the Merchant lane.else if (theShip > 10) and ClearPath("vertical") thenshow bg btn "course"return the loc of bg btn "course"elseif random(5) > 2 then --More vertical moves than horizontalput "vertical" into ShipIsMovingelseput "horizontal" into ShipIsMovingend ifend ifif ShipIsMoving = "vertical" thenput FindLeftRightTarget(lo,hi) into yyyyyset the loc of bg btn "Course" to x,yyyyyput 0 into Repsrepeat until ClearPath(ShipIsMoving)set cursor to busyadd 1 to Repsif Reps > 10 thenanswer "Computer forfeits move because it's too stupid. One mast will be lost as a result." with "Gee whiz"put true into Forfeitexit repeatelse if Reps > 5 thenput "horizontal" into ShipIsMovingset the loc of bg btn "course" to ((random(330)+90)div 30)*30,yelseset the loc of bg btn "course" to x,((random(271)+59)div 30)*30end ifend repeatshow bg btn "course"elseput FindUpDownTarget(lo,hi) into xxxxxset the loc of bg btn "Course" to xxxxx,yput 0 into Repsrepeat until ClearPath(ShipIsMoving)set cursor to busyadd 1 to Repsif Reps > 10 thenanswer "Computer forfeits move because it's too stupid. One mast will be lost as a result." with "Gee whiz"put true into Forfeitexit repeatelse if Reps > 5 thenput "vertical" into ShipIsMovingset the loc of bg btn "course" to x,((random(271)+59)div 30)*30elseset the loc of bg btn "course" to ((random(330)+90)div 30)*30,yend ifend repeatshow bg btn "course"end ifreturn the loc of bg btn "Course"end ComputerPlotCoursefunction FindLeftRightTarget lo,higlobal theShiprepeat with i = lo to hiif ((item 1 of the loc of bg btn i = (item 1 of the loc of bg btn theShip) + 30) and the visible of bg btn i) ¬OR ((item 1 of the loc of bg btn i = (item 1 of the loc of bg btn theShip) - 30) and the visible of bg btn i) then--If a ship would be to the left or right and it's visible.return item 2 of the loc of bg btn iexit repeatend ifend repeatreturn 0end FindLeftRightTargetfunction FindUpDownTarget lo,higlobal theShipput false into FoundMerchantif theShip > 10 thenrepeat with i = 1 to 4if (item 2 of the loc of bg btn ("Merchant" & i) = (item 2 of the loc of bg btn theShip) - 30) then--If a merchant ship would be directly above theShip.put true into FoundMerchantreturn item 1 of the loc of bg btn ("Merchant"& i)exit repeatend ifend repeatend ifif FoundMerchant then exit FindUpDownTargetrepeat with i = lo to hiif (item 2 of the loc of bg btn i = (item 2 of the loc of bg btn theShip) + 30) ¬OR (item 2 of the loc of bg btn i = (item 2 of the loc of bg btn theShip) - 30) then--If a ship would be directly above or below theShip.return item 1 of the loc of bg btn iexit repeatend ifend repeatreturn 0end FindUpDownTargetfunction Anti xif x = 1 thenreturn 11else if x = 10 thenreturn 20else if x = 11 thenreturn 1else if x = 20 thenreturn 10else if x = "Red" thenreturn "Blue"else if x = "Blue" thenreturn "Redend ifend Antion RemoveSail colorglobal theShipput theShip into HitShipsExplode HitShips,colorend RemoveSail</script>
</part>
<part>
<id>35</id>
<type>field</type>
<visible> <false /> </visible>
<dontWrap> <false /> </dontWrap>
<dontSearch> <true /> </dontSearch>
<sharedText> <false /> </sharedText>
<fixedLineHeight> <false /> </fixedLineHeight>
<autoTab> <false /> </autoTab>
<lockText> <true /> </lockText>
<rect>
<left>52</left>
<top>50</top>
<right>461</right>
<bottom>315</bottom>
</rect>
<style>shadow</style>
<autoSelect> <false /> </autoSelect>
<showLines> <false /> </showLines>
<wideMargins> <true /> </wideMargins>
<multipleLines> <false /> </multipleLines>
<reservedFamily> 0 </reservedFamily>
<titleWidth>0</titleWidth>
<icon>0</icon>
<textAlign>left</textAlign>
<font>New York</font>
<textSize>12</textSize>
<textStyle>plain</textStyle>
<textHeight>16</textHeight>
<name>About</name>
<script>on mousedownhide meend mousedown</script>
</part>
<name></name>
<script>on ArrangeShipshide bg btn "Course"repeat with i = 1 to 4set the loc of bg btn ("Merchant" & i) to (30 * i * 2) + 90,30set the icon of bg btn ("Merchant" & i) to "Merchant"show bg btn ("Merchant" & i)end repeatset the icon of bg btn 1 to "S 3 Mast"set the icon of bg btn 2 to "S 3 Mast"set the icon of bg btn 3 to "S 1 Mast"set the icon of bg btn 4 to "S 1 Mast"set the icon of bg btn 5 to "S 2 Mast"set the icon of bg btn 6 to "S 2 Mast"set the icon of bg btn 7 to "S 1 Mast"set the icon of bg btn 8 to "S 1 Mast"set the icon of bg btn 9 to "S 3 Mast"set the icon of bg btn 10 to "S 3 Mast"repeat with i = 1 to 10set the loc of bg btn i to (i*15*2)+90,(2*15*2)set the hilite of bg btn i to falseshow bg btn iend repeatset the icon of bg btn 11 to "N 3 Mast"set the icon of bg btn 12 to "N 2 Mast"set the icon of bg btn 13 to "N 3 Mast"set the icon of bg btn 14 to "N 4 Mast"set the icon of bg btn 15 to "N 1 Mast"set the icon of bg btn 16 to "N 3 Mast"set the icon of bg btn 17 to "N 1 Mast"set the icon of bg btn 18 to "N 2 Mast"set the icon of bg btn 19 to "N 4 Mast"set the icon of bg btn 20 to "N 2 Mast"repeat with i = 1 to 10set the loc of bg btn (i + 10) to (i*15*2)+90,(10*15*2)set the hilite of bg btn (i + 10) to falseshow bg btn (i + 10)end repeatend ArrangeShipson Blink shipset the hilite of bg btn ship to trueset the hilite of bg btn ship to falseend Blinkfunction BlueWonglobal RedShips,SoundOnif RedShips = 0 thenif SoundOn then play "Flute" tempo 290 "c4 d g g ge g fq e cq. ce dq ge g gq g fh. gq d g g g f c5 ch f4q f e c dh"answer "The Blue Navy has won!!" with "Yippeee!"return trueelsereturn falseend ifend BlueWonfunction ClearPath dir --dir = ShipIsMoving Ÿ "vertical" or "horizontal"global theShipput the loc of bg btn theShip into shpput the loc of bg btn "course" into crsif (shp = crs) or (item 1 of crs = 0) or (item 2 of crs = 0) thenreturn falseexit ClearPathend ifif dir = "vertical" thenif item 2 of shp < item 2 of crs then --moving DOWNrepeat with i = 1 to 20put the loc of bg btn i into zif (item 2 of z > item 2 of shp) and (item 2 of z <= item 2 of crs) and (item 1 of z = item 1 of shp) thenreturn falseend ifend repeatelse --moving UPrepeat with i = 1 to 20put the loc of bg btn i into zif (item 2 of z < item 2 of shp) and (item 2 of z >= item 2 of crs) and (item 1 of z = item 1 of shp) thenreturn falseend ifend repeatend ifelseif item 1 of shp < item 1 of crs then --moving RIGHTrepeat with i = 1 to 20put the loc of bg btn i into zif (item 1 of z > item 1 of shp) and (item 1 of z <= item 1 of crs) and (item 2 of z = item 2 of shp) thenreturn falseend ifend repeatelse --moving LEFTrepeat with i = 1 to 20put the loc of bg btn i into zif (item 1 of z < item 1 of shp) and (item 1 of z >= item 1 of crs) and (item 2 of z = item 2 of shp) thenreturn falseend ifend repeatend ifend ifreturn trueend ClearPathon Explode hitShips,Colourglobal RedShips,BlueShips,MerchantShips,SoundOnif the number of items of hitShips > 0 thenset cursor to nonerepeat with i = 1 to the number of items of hitShipsif SoundOn then play "Fire"put the icon of bg btn (item i of hitShips) into savedIconwait until the sound is doneif SoundOn then play "Hit"set the icon of bg btn (item i of hitShips) to "Explode"set the icon of bg btn (item i of hitShips) to savedIconset the icon of bg btn (item i of hitShips) to "Explode"if (char 4 of savedIcon = 1) or (item i of hitShips contains "Merchant") thenhide bg btn (item i of hitShips)set the loc of bg btn (item i of hitShips) to 0,0if item i of hitShips contains "Merchant" thensubtract 1 from MerchantShipselse if Colour = "Red" thensubtract 1 from BlueShipselsesubtract 1 from RedShipsend ifelseset the icon of bg btn (item i of hitShips) to savedIcon - 1end ifend repeatend ifend Explodefunction Fire lo,higlobal theShipput empty into HitShipsput item 1 of the loc of bg btn theShip into xput item 2 of the loc of bg btn theShip into yput char 1 of the icon of bg btn theShip into Facingif (Facing = 1) or (Facing = 3) thenput "NS" into Facingelseput "EW" into Facingend ifset cursor to watch--•••••• Check for merchant ships ••••••if theShip > 10 thenput x & "," & (y - 30) into xyrepeat with i = 1 to 4if (Facing = "EW") and ¬(xy is within the rect of bg btn ("Merchant" & i)) thenput "Merchant" & i & "," after HitShipsend ifend repeatend if--•••••• Check for enemy ships •••••••repeat with i = lo to hiif (abs((item 1 of the loc of bg btn i) - x) = 30) and ¬ --beside horizontal(abs((item 2 of the loc of bg btn i) - y) = 0) and ¬ --same vertical(Facing = "NS") OR ¬(abs((item 2 of the loc of bg btn i) - y) = 30) and ¬ --beside vertical(abs((item 1 of the loc of bg btn i) - x) = 0) and ¬ --same horizontal(Facing = "EW") thenput i & "," after HitShipsend ifend repeatdelete last char of HitShipsreturn HitShipsend Firefunction GetShip lo,higlobal PauseGameput false into okrepeat until okwait until the mouse is downput the mouseloc into SavedLocrepeat with i = 1 to 20if (SavedLoc is within the rect of bg btn i) and ¬(i >= lo) and (i <= hi) thenput true into okput i into xend ifend repeatif not ok thenif SavedLoc is within rect of bg btn "Pause" thenput true into PauseGameput true into okend ifend ifend repeatif the mouse is down then wait until the mouse is upreturn xend GetShipon MoveShipglobal theShip,theCourseput item 1 of the loc of bg btn theShip into xput item 2 of the loc of bg btn theShip into yput the icon of bg btn theShip into Mastsdelete char 1 to 3 of Mastsif item 1 of theCourse > x then--eastset the icon of bg btn theShip to Masts + 2000put 30 into direlse if item 1 of theCourse < x then--westset the icon of bg btn theShip to Masts + 4000put -30 into direlse if item 2 of theCourse > y then--southset the icon of bg btn theShip to Masts + 3000put 30 into direlse if item 2 of theCourse < y then--northset the icon of bg btn theShip to Masts + 1000put -30 into dirend ifif (char 1 of the icon of bg btn theShip = 1) or (char 1 of the icon of bg btn theShip = 3) then--north/southrepeat until the loc of bg btn theShip = theCourseput item 1 of the loc of bg btn theShip into xput (item 2 of the loc of bg btn theShip) + dir into yif not OnLand(x,y) thenset the loc of bg btn theShip to x,yelsebeepexit repeatend ifend repeatelse--east/westrepeat until the loc of bg btn theShip = theCourseput (item 1 of the loc of bg btn theShip) + dir into xput item 2 of the loc of bg btn theShip into yif not OnLand(x,y) thenset the loc of bg btn theShip to x,yelsebeepexit repeatend ifend repeatend ifhide bg btn "Course"end MoveShipfunction OnLand x,yglobal theShipput false into Bangorepeat with i = 25 to 27if ((x & "," & y) is within the rect of bg btn i ) thenput true into Bangoexit repeatend ifend repeatreturn Bangoend OnLandfunction PlotCourseglobal theShip--set cursor to noneput false into okyDokyset the loc of bg btn "Course" to ((item 1 of the mouseloc + 10) div 30)*30,((item 2 of the mouseloc - 20) div 30)*30+30show bg btn "course"put item 1 of the loc of bg btn theShip into xput item 2 of the loc of bg btn theShip into yrepeatrepeat until the mouse is downBlink theShipif abs(item 1 of the mouseloc - x) < abs(item 2 of the mouseloc - y) thenset the loc of bg btn "Course" to x,((item 2 of the mouseloc - 20) div 30)*30+30put "vertical" into ShipIsMovingelseset the loc of bg btn "Course" to ((item 1 of the mouseloc + 10) div 30)*30,yput "horizontal" into ShipIsMovingend ifend repeatif the loc of bg btn "Course" ≠ the loc of bg btn theShip thenput true into okyDokyend ifif ClearPath(ShipIsMoving) and not(OnLand(item 1 of the loc of bg btn "course",item 2 of the loc of bg btn "course")) then exit repeatend repeatif the mouse is down then wait until the mouse is upreturn the loc of bg btn "Course"end PlotCoursefunction RedWonglobal MerchantShips,BlueShips,SoundOnif BlueShips = 0 thenif SoundOn then play "Flute" tempo 290 "c4 d g g ge g fq e cq. ce dq ge g gq g fh. gq d g g g f c5 ch f4q f e c dh"answer "The Blue Navy is out of warships, so the Red Navy wins by default." with "Yeah!"return trueelse if MerchantShips = 0 thenif SoundOn then play "Flute" tempo 290 "c4 d g g ge g fq e cq. ce dq ge g gq g fh. gq d g g g f c5 ch f4q f e c dh"answer "The Red Navy has won!!" with "Yeehaa!"return trueelsereturn falseend ifend RedWonon ReturnFire ships,colourglobal theShipif the number of items of ships > 0 thenif colour = "Red" thenput "Blue" into colourelseput "Red" into colourend ifrepeat with i = 1 to the number of items of shipsif (the visible of bg btn (item i of ships)) and ¬((char 1 of the icon of bg btn (item i of ships)) mod 2 = (char 1 of the icon of bg btn theShip) mod 2) thenExplode theShip,colourend ifend repeatend ifend ReturnFire</script>